<div ng-controller="ItemCtrl" ng-init="listAction()">
    <ul class="sui-breadcrumb">
        <li>
            <a href="#/item/list">{{ "Item" | translate }}</a>
        </li>
        <li class="active">
            {{ "List" | translate }}
            <a href="#/item/add" id="addNew" class="sui-btn btn-primary">+{{ "add_new" | translate }}</a>
            <a href="#/item/import" class="sui-btn btn-primary">{{"导入" | translate}}</a>
            <a href="#/item/virtual" class="sui-btn btn-primary">{{"组合商品" | translate}}</a>
        </li>
        <span class="sui-form sui-form pull-right">
			<!-- <pickpoint-list ng-model="select_pickpoint_id" dft="0"></pickpoint-list> -->
            条码:<input type="text" placeholder="{{ 'sku条码' | translate }}" ng-model="barcode" />
            编码:<input type="text" placeholder="{{ 'sku编码' | translate }}" ng-model="sku_outer_id" />
            类目:<choice-cat back="selectCatid(catid)" ng-model="catid"></choice-cat>
            <button type="button" class="sui-btn btn-small  btn-danger" ng-show="catid" ng-click="catid=null">
                <i class="sui-icon icon-tb-close"></i>
            </button>
            <input type="text" placeholder="{{ 'keyword' | translate }}" ng-model="keyword" />
            <button class="sui-btn btn-primary" type="submit" ng-click="getItemList(1)">
                {{ "search" | translate }}
            </button>
        </span>
    </ul>
    <item-tab ng-model="on_shelves" click-tab="getItemList(1)"></item-tab>
    <table class="sui-table table-bordered">
        <thead>
            <tr>
                <th>#</th>
                <th nowrap>{{ "item_image" | translate }}</th>
                <th nowrap>{{ "item_id" | translate }}</th>
                <!-- <th nowrap>{{ "title" | translate }}</th> -->
                <!-- <th nowrap>{{ "类目" | translate }}</th> -->
                <!-- <th nowrap>{{ "price" | translate }}</th> -->
                <th nowrap>{{ "sku" | translate }}</th>
                <th nowrap>{{ "发货点" | translate }}</th>
                <!-- <th nowrap>{{ "商品类型" | translate }}</th> -->
                <!-- <th nowrap>{{ "是否是虚拟商品" | translate }}</th> -->
                <th nowrap>{{ "operation" | translate }}</th>
                <!-- <th nowrap>{{ "二维码" | translate }}</th> -->
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="list in itemslist">
                <td>
                    <span title="分销商品" style="padding: 1px;" class="sui-label label-danger" ng-if="list.p_item_id*1>0">销</span> <br/>
                    <input type="checkbox" name="sjmodel" checklist-model="$parent.sjmodel" checklist-value="list" />
                </td>
                <td style="width:120px;">
                    <img ng-src="{{ list.img }}" width="80" /><br> {{ list.title }}
                    <hr>
                    <span class="sui-label label-info" title="类目"><displaycat cid="list.category_id"></displaycat></span>
                </td>
                <td>
                    {{ list.item_id }}
                    <br /> {{ list.created_at | ddtt }}
                    <hr>
                    <span class="sui-label label-{{list.xtype==1?'danger':'success'}}">
                        <item-type ng-model="list.xtype" stype="1"></item-type>
                    </span>
                    <br>
                    <span class="sui-label label-warning" ng-if="list.is_virtual">虚拟商品</span>
                </td>
                <!-- <td>{{ list.title }}</td> -->
                <!-- <td>
                    <displaycat cid="list.category_id"></displaycat>
                </td> -->
                <!-- <td>{{ list.price }}</td> -->
                <td>
                    <table class="sui-table table-bordered" style="margin-bottom: 5px;">
                        <thead>
                            <tr>
                                <th>{{ "主图" | translate }}</th>
                                <th>{{ "名称" | translate }}</th>
                                <th>{{ "编码/条码" | translate }}</th>
                                <th>{{ "库存" | translate }}</th>
                                <th>{{ "价格" | translate }}</th>
                                <th>{{ "组合装" | translate }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="sku in list.skus">
                                <td>
                                    <img ng-src="{{ sku.imgurl }}" style="width: 100px" />
                                </td>
                                <td>
                                    {{ sku.sku_properties | skuname }}
                                </td>
                                <td>
                                    {{ sku.sku_outer_id }}
                                    <br /> {{ sku.barcode }}
                                </td>
                                <td>
                                    <span ng-if="list.p_item_id*1>0">{{sku.sku_stocks}}</span>
                                    <input ng-if="list.p_item_id*1==0" ng-model="sku.sku_stocks" type="number" style="width: 50px">
                                </td>
                                <td>{{ sku.sku_price}}</td>
                                <td>
                                    <sku-item-list skuid="{{sku.sku_id}}"></sku-item-list>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td>
                    <div ng-repeat="pickpoint_id in list.delivery_addrs.split(',')" style="{{ $index > 0 ? 'border-top: 1px #ddd solid;' : '' }}">
                        <pickpoint-info ng-model="pickpoint_id"></pickpoint-info>
                    </div>
                </td>
                <!-- <td>
                    <span class="sui-label label-{{list.xtype==1?'danger':'success'}}"><item-type ng-model="list.xtype" stype="1"></item-type></span>
                    <br>
                    <span class="sui-label label-warning" ng-if="list.is_virtual">虚拟商品</span>
                </td> -->
                <!-- <td>
                    虚拟：{{list.is_virtual?"是":"否"}}
                </td> -->
                <td style="width:80px;">
                    <a href="#/item/add?id={{ list.item_id }}" class="sui-btn btn-info" style="margin-bottom:10px">{{ "edit" | translate }}</a>
                    <!-- <a href="#/item/info?id={{list.item_id}}" class="sui-btn btn-primary">{{'info'|translate}}</a> -->
                    <!-- <button ng-show="list.item_id && list.status_id!='2'" type="button" class="sui-btn btn-danger" ng-click="itemSkuStatusUpdate(list,2,1)">{{'关闭商品'|translate}}</button> -->
                    <!-- <button ng-show="list.item_id && list.status_id!='1'" type="button" class="sui-btn btn-warning" ng-click="itemSkuStatusUpdate(list,1,1)">{{'enable'|translate}}</button> -->
                    <button ng-show="list.item_id && list.on_shelves!='1'" type="button" class="sui-btn btn-warning" ng-click="itemShelvesUpdate(list,1)">
                        {{ "上架" | translate }}
                    </button>
                    <button ng-show="list.item_id && list.on_shelves=='1'" type="button" class="sui-btn btn-danger" ng-click="itemShelvesUpdate(list,0)">
                        {{ "下架" | translate }}
                    </button>
                    <br />
                    <wx-qrcode stype="stype" id="list.item_id" itempath="1"></wx-qrcode>
                    <br />
                    <button ng-show=" industryCode=='27' || industryCode=='28' " type="button" class="sui-btn btn-warning" ng-click="postItemWms(list.item_id)">
                        {{"同步仓库" | translate }}
                    </button>
                    <br>
                    <button ng-show=" list.store_id == '6267' || list.store_id == '6644' || list.store_id == '6768'" type="button" class="sui-btn btn-primary" ng-click="delItem(list.item_id)">
                        {{"删除商品" | translate }}
                    </button>
                </td>
                <!-- <td style="width:80px;">
                    
                </td> -->
            </tr>
        </tbody>
    </table>
    <!-- 分页start -->
    <pager page-no="{{ pageNo }}" page-size="pageSize" total="itemsTotal" get-data="getItemList(pageNo)"></pager>
    <!-- 分页end -->
    <span ng-show="itemslist.length">
        <button ng-click="checkAll()" class="sui-btn btn-success">
            全选
        </button>
        <button ng-click="nocheckAll()" class="sui-btn btn-success">
            反选
        </button>
    </span>
    <span ng-show="sjmodel.length">
    <button type="button" class="sui-btn btn-warning" ng-show="on_shelves ==0" ng-click="batchItemShelvesUpdate(1)">
      {{ "批量上架" | translate }}
    </button>
    <button type="button" class="sui-btn btn-danger"  ng-show="on_shelves ==1"  ng-click="batchItemShelvesUpdate(0)">
      {{ "批量下架" | translate }}
    </button>
    <button ng-show=" list.store_id == '6267' || list.store_id == '6644' || list.store_id == '6768'" type="button" class="sui-btn btn-danger"  ng-click="delAllItem()">
        {{ "批量删除" | translate }}
    </button>
    <chose-pickpoint member-check="batchSavePick(pickpoint)" title="绑定发货地址" type="1"
      xclass="sui-btn btn-success ng-binding" chosed-items="pickpoint"></chose-pickpoint>
    <batch-label callback="batchSaveLabel(data)"></batch-label>
    <batch-freight callback="batchSavefreight(data)"></batch-freight>
    <batch-itme-stype callback="batchSaveStype(data)"></batch-itme-stype>
    <!-- <batch-cat callback="batchSaveLabel(data)" ></batch-cat> -->
    <button class="sui-btn btn-primary" type="submit" ng-click="batchSaveItem()">
        {{ "更新库存" | translate }}
    </button>
    </span>
</div>